package ase.eleitweg.client.gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Auftragsstatus_gui {

	protected Shell shell;

	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Auftragsstatus_gui window = new Auftragsstatus_gui();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window
	 */
	public void open() {
		final Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	/**
	 * Create contents of the window
	 */
	protected void createContents() {
		shell = new Shell(SWT.CLOSE);
		shell.setLayout(new FormLayout());
		shell.setSize(300, 150);
		Rectangle screenSize = Display.getCurrent().getClientArea();
		shell.setLocation((screenSize.width-shell.getSize().x)/2, (screenSize.height-shell.getSize().y)/2);
		shell.setText("Auftragsstatus");

		Composite composite;

		Composite composite_1;

		Button abbrechenButton;
		shell.pack();
		composite = new Composite(shell, SWT.NONE);
		final FormData fd_composite = new FormData();
		fd_composite.right = new FormAttachment(100, -103);
		fd_composite.bottom = new FormAttachment(0, 77);
		fd_composite.top = new FormAttachment(0, 10);
		fd_composite.left = new FormAttachment(0, 102);
		composite.setLayoutData(fd_composite);
		final GridLayout gridLayout_1 = new GridLayout();
		composite.setLayout(gridLayout_1);

		final Button annehmenButton = new Button(composite, SWT.RADIO);
		annehmenButton.setText("Annehmen");

		final Button ablehnenButton = new Button(composite, SWT.RADIO);
		ablehnenButton.setLayoutData(new GridData());
		ablehnenButton.setText("Ablehnen");

		final Button weiterleitenButton = new Button(composite, SWT.RADIO);
		weiterleitenButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
		weiterleitenButton.setText("Weiterleiten");
		composite_1 = new Composite(shell, SWT.NONE);
		final FormData fd_composite_1 = new FormData();
		fd_composite_1.right = new FormAttachment(100, -60);
		fd_composite_1.bottom = new FormAttachment(100, -10);
		fd_composite_1.top = new FormAttachment(0, 87);
		fd_composite_1.left = new FormAttachment(0, 59);
		composite_1.setLayoutData(fd_composite_1);
		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		composite_1.setLayout(gridLayout);

		final Button okButton = new Button(composite_1, SWT.NONE);
		final GridData gd_okButton = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
		gd_okButton.widthHint = 80;
		okButton.setLayoutData(gd_okButton);
		okButton.setText("OK");
		abbrechenButton = new Button(composite_1, SWT.NONE);
		final GridData gd_abbrechenButton = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
		gd_abbrechenButton.widthHint = 80;
		abbrechenButton.setLayoutData(gd_abbrechenButton);
		abbrechenButton.addMouseListener(new MouseAdapter() {
			public void mouseDown(final MouseEvent e) {
				shell.close();
			}
		});
		abbrechenButton.setText("Abbrechen");
		//
	}

}
